<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>完善个人信息</title>
<script type="text/javascript" src="Public/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="Public/js/Validform_v5.3_min.js"></script>
<script type="text/javascript" src="Public/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="Public/js/province_city_county.js"></script>
<script type="text/javascript" src="Public/bootstrap/js/bootstrap-datepicker.js"></script>

<link rel="stylesheet" href="Public/bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="Public/bootstrap/css/datepicker.css">
<link rel="stylesheet" href="theme/default/css/validform.css">
<link rel="stylesheet" href="Public/bootstrap/css/datepicker.css">
<link rel="stylesheet" href="Public/css/login-page.css">

<style type="text/css">
.pro_add_nav { width:960px; margin:0 auto; overflow:hidden;margin-top:20px}
.pro_add_nav li p {Overflow:hidden;height:36px;padding-top:6px;}
.pro_add_nav .p_0 {height:16px;line-height:16px;overflow:hidden;padding:15px 0;font-size:14px;}
.pro_add_nav .p_0 span {float:left;}
.pro_add_nav .p_0 a {float:right;padding-left:24px;color:#0066a1;background:url(/Public/images/ico_0.png) 0 0 no-repeat;}
.pro_add_nav .p_0 a:hover {color:#f60;}
.pro_add_nav ul {width:100%;height:36px;overflow:hidden;line-height:36px;font-size:14px;}
.pro_add_nav li {float:left;height:36px;overflow:hidden;font-weight:700;letter-spacing:1px;}
.pro_add_nav li p a {color:#666; text-decoration:none;
}
.pro_add_nav li p.active a {color:#fff;}
.pro_add_nav li p.visited a {color:#ff9900;}
.pro_add_nav li.li_0 {width:244px;}
.pro_add_nav li.li_0 p {background:url(/Public/images/pro_nav.png) 0 0 no-repeat;padding-left:20px;}
.pro_add_nav li.li_0 p.active {background-position:0 -40px;}
.pro_add_nav li.li_1 {width:261px;margin-left:-14px;}
.pro_add_nav li.li_1 p {background:url(/Public/images/pro_nav.png) 0 -80px no-repeat;padding-left:34px;}
.pro_add_nav li.li_1 p.visited {background-position:0 -120px;}
.pro_add_nav li.li_1 p.active {background-position:0 -160px;}
.pro_add_nav li.li_2 {width:235px;margin-left:-14px;}
.pro_add_nav li.li_2 p {background:url(/Public/images/pro_nav.png) 0 -200px no-repeat;padding-left:34px;}
.pro_add_nav li.li_2 p.visited {background-position:0 -280px;}
.pro_add_nav li.li_2 p.active {background-position:0 -240px;}
</style>
</head>

<body>
<include file="./template/default/Public/header-form.html" />

<div class="container">

<div class="pro_add_nav">
		<ul id="pro_add_nav" class="clearfix">
			<li class="li_0">
				<p class="visited"><span style="color:#fff">1 注册成功!</span></p>
			</li>
<?php
if($_SESSION['session_regstep']==2){
?>
<li class="li_1">
				<p class="active"><a href="javascript:void(0)" hidefocus="true" title="完善个人信息">2 完善个人信息</a></p>
</li>
<?php
}else{
?>
<li class="li_1">
				<p class="visited"><span style="color:#fff">2 完善个人信息</span></p>
</li>
<?php
}
?>

<?php
if($_SESSION['session_regstep']==3){
?>

<li class="li_1">
				<p class="active"><a href="javascript:void(0)" hidefocus="true" title="添加宝宝信息">3 添加宝宝信息</a></p>
			</li>
<?php
}else{
?>
<li class="li_1">
				<p class="visited"><span style="color:#fff">3 添加宝宝信息</span></p>
			</li>
<?php
}
?>
           
			
			
			<li class="li_2"><p>
							<a href="javascript:void(0)" hidefocus="true" title="完成， 开始记录!">4 前往成长之旅!</a>
						</p></li>
		</ul>
</div>

<?php
if($_SESSION['session_regstep']==2){
?>


<form class="form-horizontal" action="/index.php?s=/Home/User/UpdateStep/" method="post" id="personal_form">

<fieldset>
          <legend>完善个人信息</legend>
          <div class="control-group">
            <label class="control-label" for="input01"><span class="need">*</span>昵称</label>
            <div class="controls">
              <input type="text" class="input-xlarge" id="nickname" name="nickname" datatype="s1-20" nullmsg="昵称不能为空!">
              <p class="help-block">
		用于显示公众页面
	      </p>
            </div>
          </div>
          
          <div class="control-group">
            <label class="control-label" for="input01"><span class="need">*</span>真实姓名</label>
            <div class="controls">
              <input type="text" class="input-xlarge" id="realname" name="realname" datatype="s2-5" nullmsg="真实姓名不能为空!">
              <p class="help-block">
		请输入真实姓名，保密
	      </p>
            </div>
          </div>
          <div class="control-group">
            <label class="control-label" for="optionsCheckbox"><span class="red">*</span>性别</label>
            <div class="controls">
              <label class="radio inline" title="女">女<input type="radio" name="sex_type" value="0" checked>&nbsp;&nbsp;</label>
              <label class="radio inline" title="男">男<input type="radio" name="sex_type" value="1"></label>
              
            </div>
          </div>
          <div class="control-group">
            <label class="control-label" for="optionsCheckbox"><span class="red">*</span>婚姻状况</label>
            <div class="controls">
              <select name="ismarry" id="ismarry">
              	<option value="1" selected>已婚</option>
                <option value="0">未婚</option>
              </select>              
            </div>
          </div>
          <div class="control-group">
            <label class="control-label" for="optionsCheckbox"><span class="red">*</span>居住城市</label>
            <div class="controls">
              <div id="province_area"></div>
              <p class="help-block"></p>
            </div>
          </div>
<?php
if(preg_match("/^13[0-9]{1}[0-9]{8}$|15[0189]{1}[0-9]{8}$|189[0-9]{8}$/",$mobile)){    
    //验证通过    
?>          
          <div class="control-group">
            <label class="control-label" for="optionsCheckbox"><span class="red">*</span>联系手机</label>
            <div class="controls">

<input type="text" class="input-xlarge mobile" id="mobile" name="mobile" datatype="m" nullmsg="手机号码不能为空!" errormsg="手机号码格式不对!" value="{$mobile}" style="width:200px" readonly>
         
              
              <p class="help-block"></p>
            </div>
          </div>
 <?php
 }
 ?>         
<?php
if(preg_match("/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i",$email)){    
    //验证通过    
?>          
          <div class="control-group">
            <label class="control-label" for="optionsCheckbox"><span class="red">*</span>联系邮件</label>
            <div class="controls">

<input type="text" class="input-xlarge mobile" id="email" name="email" datatype="e" nullmsg="email不能为空!" errormsg="email格式不对!" value="<?php echo $email;?>" style="width:200px" readonly>
         
              
              <p class="help-block"></p>
            </div>
          </div>
 <?php
 }
 ?>          
          
          
          <div class="form-actions">
          <input type="hidden" name="next" value="2"/>
            <button type="submit" class="btn btn-green">下一步</button>
            &nbsp;<span id="msg"></span>
          </div>
        </fieldset>
	
</form>
<script type="text/javascript">
$(document).ready(function(){
$("#province_area").province_city_county();
$("#personal_form").Validform({
		tiptype:function(msg,o,cssctl){
			var objtip=$("#msg");
			cssctl(objtip,o.type);
			objtip.text(msg);
		}
	});

});

</script>
<?php
}
?>

<?php
if($_SESSION['session_regstep']==3){
?>
<script type="text/javascript">
var fb_i = 2;
function fb_add(){
	$('#fb_info_wrap').append('<div id="fb_block_'+fb_i+'"><hr class="small"><div class="clearfix tab-content" id="fb_info_'+fb_i+'">  <a class="close" onclick="del_fb_info('+fb_i+')" data-dismiss="alert" title="删除">×</a>        <div class="control-group">            <label class="control-label" for="fb_name_'+fb_i+'">宝宝姓名</label>            <div class="controls">              <input type="text" class="input-xlarge" id="fb_name_'+fb_i+'" name="fb_name[]">              <p class="help-block">		请输入真实姓名，保密	      </p>            </div>          </div>          <div class="control-group">            <label class="control-label" for="fb_sex_1"><i>*</i>宝宝性别</label>            <div class="controls">             <label class="radio"><input type="radio" name="fb_sex[]" id="fb_sex_1" value="1" />男孩</label>              <label class="radio"><input type="radio" name="fb_sex[]" id="fb_sex_0" value="0" />女孩</label>              <p class="help-block">			      </p>            </div>          </div>                    <div class="control-group">            <label class="control-label" for="fb_borndate">宝宝出生日期：</label>            <div class="controls">               <input type="text" name="fb_borndate[]" id="fb_borndate_'+fb_i+'" class="input-xlarge">                <p class="help-block"><div class="alert alert-info">(宝宝的生日一旦填写将不能随意修改，如有变更请发邮件到客服邮箱facesbaby@126.com申请，申请时请务必注明您的用户昵称、注册邮箱和宝宝的正确生日日期。)</div>	      </p>            </div>          </div></div></div>');
	fb_i++;

}
function del_fb_info(fb_num){
	$("#fb_block_"+fb_num).remove();
}
function jumpStep(step){
	if(step!=""){
	//
	$.ajax({
		url:"/index.php?s=/Home/User/trip/",
		type:"GET",
		data:"step/"+step,
		dataType:"json",
		success:function(data){
			if(data.flag=="success"){
				//成功
				location.href='/index.php';
			}else{
				//更新失败
				
			}
		}
	});	
	}
}
function remove_tab(val){
	//删除tab,及tab内容
	$('#tab_content_'+val).remove();
	$('#tab_'+val).remove();
 $('#fb_info_nav a:first').tab('show');
}
var tab_i=1;
function tab_add(){
	var tab_btn = '<li id="tab_'+tab_i+'"><a href="#tab_content_'+tab_i+'" id="tablink_'+tab_i+'">宝宝'+tab_i+'</a></li>';
	var tab_html = '          <div class="control-group">            <label class="control-label" for="fb_pregnant_'+tab_i+'">宝宝目前</label>            <div class="controls"><input type="hidden" name="baby_id[]" value="'+tab_i+'"><select name="fb_pregnant_'+tab_i+'" id="fb_pregnant_'+tab_i+'">              <option value="1" selected>已出生</option>              <option value="2">怀孕中</option>              </select>            </div>          </div>           <div class="control-group">            <label class="control-label" for="fb_nickname_'+tab_i+'">宝宝昵名</label>            <div class="controls">              <input type="text" class="input-middle" id="fb_nickname_'+tab_i+'" name="fb_nickname_'+tab_i+'">              <p class="help-block">	      </p>            </div>          </div>          	          <div class="control-group">            <label class="control-label" for="fb_name_'+tab_i+'">宝宝姓名</label>            <div class="controls">              <input type="text" class="input-middle" id="fb_name_'+tab_i+'" name="fb_name_'+tab_i+'">              <p class="help-block">		请输入真实姓名，保密	      </p>            </div>          </div>          <div class="control-group">            <label class="control-label" for="fb_sex_'+tab_i+'"><i>*</i>宝宝性别</label>            <div class="controls">             <label class="radio"><input type="radio" name="fb_sex_'+tab_i+'" id="fb_sex_'+tab_i+'_1" value="1" />男孩</label>              <label class="radio"><input type="radio" name="fb_sex_'+tab_i+'" id="fb_sex__'+tab_i+'_0" value="0" />女孩</label>              <label class="radio"><input type="radio" name="fb_sex_'+tab_i+'" id="fb_sex_'+tab_i+'_2" value="2" />不清楚</label>              <p class="help-block">			      </p>            </div>          </div>          <div class="control-group">            <label class="control-label" for="fb_borndate_'+tab_i+'">宝宝预产期：</label>                          <div class="controls"><div class="input-append date fb_expectedate" data-date="">  <input class="span2" size="16" type="text" value="" name="fb_expectedate_'+tab_i+'" style="width:100px;" id="fb_borndate_'+tab_i+'" readonly>  <span class="add-on"><i class="icon-th"></i></span></div>                          <p class="help-block"></p>              </div>                            </div>                        <div class="control-group">            <label class="control-label" for="fb_borndate_'+tab_i+'">宝宝出生日期：</label>            <div class="controls"><div class="input-append date fb_borndate" data-date="">  <input class="span2" size="16" type="text" value="" name="fb_borndate_'+tab_i+'" style="width:100px;" id="fb_borndate_'+tab_i+'" readonly>  <span class="add-on"><i class="icon-th"></i></span></div>                                          <p class="help-block"><div class="alert alert-info">(宝宝的生日一旦填写将不能随意修改，如有变更请发邮件到客服邮箱facesbaby@126.com申请，申请时请务必注明您的用户昵称、注册邮箱和宝宝的正确生日日期。)</div>	      </p>            </div>          </div>';
	var tab_content ='<div class="tab-pane" id="tab_content_'+tab_i+'" style="position:relative"><div style="position:absolute;left:10px; top:1px;"><a onclick="remove_tab(\''+tab_i+'\')" href="javascript:void(0)"><i class="icon-remove"></i></a></div>'+tab_html+'</div>';
	
	$('#fb_info_wrap').append(tab_content);
	$('#fb_info_nav').append(tab_btn);
	tab_i++;
$('#fb_info_nav a').click(function (e) {
  e.preventDefault();
  $(this).tab('show');
 // $(this).parent().addClass('active');
});
setDatepicker();
}
</script><!---->
<form class="form-horizontal" action="/index.php?s=/Home/User/UpdateStep" method="post" id="fb_form">
<fieldset>
          <legend>添加宝宝信息</legend>
          
<div class="row" style="position:relative">          
<ul class="nav nav-tabs" id="fb_info_nav">
  <li class="active" id="baby_add">
    <a href="#tab_content_0" id="tablink_0">宝宝信息</a>
  </li>
</ul>  
<span style="position:absolute;right:2px;top:8px;"><a onclick="tab_add()" href="javascript:void(0)"><i class="icon-plus-sign"></i>添加</a></span>
</div>
   
<div id="fb_info_wrap" class="tab-content">
<div class="clearfix tab-pane active" id="tab_content_0">
          <div class="control-group">
            <label class="control-label" for="fb_pregnant_0">宝宝目前</label>
            <div class="controls">
            <input type="hidden" name="baby_id[]" value="0">
              <select name="fb_pregnant_0" id="fb_pregnant_0">
              <option value="1" selected>已出生</option>
              <option value="2">怀孕中</option>
              </select>
            </div>
          </div>
          <script type="text/javascript">
		  $(function(){
			  
		  });
		  </script>
          
         
         <div class="control-group">
            <label class="control-label" for="fb_nickname_0">宝宝昵名</label>
            <div class="controls">
              <input type="text" class="input-middle" id="fb_nickname_0" name="fb_nickname_0">
              <p class="help-block">
	      </p>
            </div>
          </div>
          	
          <div class="control-group">
            <label class="control-label" for="fb_name_0">宝宝姓名</label>
            <div class="controls">
              <input type="text" class="input-middle" id="fb_name_0" name="fb_name_0">
              <p class="help-block">
		请输入真实姓名，保密
	      </p>
            </div>
          </div>
          <div class="control-group">
            <label class="control-label" for="fb_sex_0"><i>*</i>宝宝性别</label>
            <div class="controls">
             <label class="radio"><input type="radio" name="fb_sex_0" id="fb_sex_0_1" value="1" />男孩</label>
              <label class="radio"><input type="radio" name="fb_sex_0" id="fb_sex_0_0" value="0" />女孩</label>
              <label class="radio"><input type="radio" name="fb_sex_0" id="fb_sex_0_2" value="2" />不清楚</label>
              <p class="help-block">
		
	      </p>
            </div>
          </div>
          <div class="control-group">
            <label class="control-label" for="fb_expectedate_0">宝宝预产期：</label>            
              <div class="controls">

<div class="input-append date fb_expectedate" id="fb_expectedate" data-date="">
  <input class="span2" size="16" type="text" value="" name="fb_expectedate_0" style="width:100px;" id="fb_expectedate_0" readonly>
  <span class="add-on"><i class="icon-th"></i></span>
</div>            
              <p class="help-block">

</p>
              </div>
              
              </div>
              
          <div class="control-group">
            <label class="control-label" for="fb_borndate_0">宝宝出生日期：</label>
            <div class="controls">

<div class="input-append date fb_borndate" id="fb_borndate" data-date="">
  <input class="span2" size="16" type="text" value="" name="fb_borndate_0" style="width:100px;" id="fb_borndate_0" readonly>
  <span class="add-on"><i class="icon-th"></i></span>
</div>              
              
              <p class="help-block">
<div class="alert alert-info">
(宝宝的生日一旦填写将不能随意修改，如有变更请发邮件到客服邮箱facesbaby@126.com申请，申请时请务必注明您的用户昵称、注册邮箱和宝宝的正确生日日期。)
</div>
	      </p>
            </div>
          </div>
</div><!--end fb_info_1--> 


</div><!--end fb_info_wrap-->       
          
          <div class="form-actions">
          <input type="hidden" name="next" value="3">
            <button type="submit" class="btn btn-green">下一步</button>
            &nbsp;<button type="button" onClick="jumpStep(5)" class="btn btn-green">先逛逛，跳过此步骤&raquo;</button>
            &nbsp;
          </div>
          




 
          
</fieldset>       
</form>
<script type="text/javascript">
$(document).ready(function(){
$("#fb_form").Validform({
		tiptype:function(msg,o,cssctl){
			var objtip=$("#msg");
			cssctl(objtip,o.type);
			objtip.text(msg);
		}
	});
setDatepicker();

});
function setDatepicker(){
	$('.fb_borndate').datepicker({
	format: 'yyyy-mm-dd'	
	}).on('changeDate',function(ev){
		$('.fb_borndate').datepicker('hide');
	});
	
	$('.fb_expectedate').datepicker({
	format: 'yyyy-mm-dd'	
	}).on('changeDate',function(ev){
		$('.fb_expectedate').datepicker('hide');
	});	
}
</script>
<?php
}
?>
</div>

<?php
if($_SESSION['session_regstep']==115){
?>
<script type="text/javascript">
function SetFocus(baby_id,vid){
	var baby_flag=$('#baby_flag_'+baby_id).val();
	var flag='';
	if(baby_flag==0){
		//关注
		flag = 1;
	}else{
		//未关注
		flag = 0;
	}
	$.ajax({
	url:'/index.php',
	type:'GET',
	data:'s=/Home/Baby/setFoucs/baby_id/'+baby_id+'/vid/'+vid+'/flag/'+flag+'/tp/'+new Date().getTime(),
	dataType:'json',
	success:function(json){
		
		$('#baby_flag_'+baby_id).attr("value",flag);
		//alert(flag);
		if(flag==1){
		$('#focus_btn_'+baby_id).html('关注中');	
		$('#focus_btn_'+baby_id).addClass('btn-success');
		}else{
			$('#focus_btn_'+baby_id).removeClass('btn-success');
		}
	}
	});
}

function GetInvite(){
	var invite_code = $.trim($('#invite_code').val());
	$('#invite_flag').html('');
	if(invite_code!=''){
		//邀请码不为空
		$('#invite_flag').html('<img src="/Public/images/spinner.gif" align="absmiddle" width="24" height="24"> 数据查询中...');
		$.ajax({
			url:"/index.php",
			type:"GET",
			data:"s=/Home/Baby/queryFocus/invite_code/"+invite_code+"/tp/"+new Date().getTime(),
			dataType:"json",
			success:function(json){
				var html = '';
				$('#invite_flag').html('');
				if(json.length>0){
				//有数据
					$('#invite_flag').html('邀请码有效!');
					//进行数据显示
					$.each(json,function(dataIndex,data){
						html+='<li><div><img src="'+data.baby_icon+'"><div class="caption"><h3>'+data.baby_realname+'</h3><p><input type="hidden" id="baby_flag_'+data.baby_id+'" value="0"><button class="btn" onclick="SetFocus('+data.baby_id+','+data.v_id+')" id="focus_btn_'+data.baby_id+'">我要关注</button></p></div></div></li>';
					});
					
					$('#baby_thumb').html(html);
				}else{
				//无数据
				$('#invite_flag').html('邀请码不正确或已经被使用!');
				}
			}
				
		});
	}else{
		$('#invite_code').focus();
		$('#invite_flag').html('邀请码不能为空!');
	}
}
</script>
<div class="container">

<div class="row">
<form class="form-inline" onSubmit="return false;">            
<label>输入邀请码 </label>
&nbsp;
<input type="text" name="invite_code" id="invite_code"> 
&nbsp;
<button type="button" class="btn" onClick="GetInvite()">查看详情</button>
&nbsp;
<span id="invite_flag"></span>
</form>
</div>

<div class="row">
<ul id="baby_thumb"></ul>
</div>

<div class="row">
<ul id="baby_foucs"></ul>
</div>

</div>

<script type="text/javascript">
function ListInvite(){
	$.ajax({
		url:'/index.php?s=/Home/Baby/ListFocus',
		dataType:'JSON',
		type:'GET',
		success:function(json){
			
			//baby_foucs
			var focus_list = '';
			$.each(json,function(dataIndex,data){
				focus_list += '<li><a href="/index.php?s=/Home/Baby/myFoucs/babyid/'+data.baby_id+'">'+data.baby_realname+'</a></li>';
			});
			$('#baby_foucs').html(focus_list);
		}
		
	});	
}
$(document).ready(function(){
	ListInvite();
});
</script>

<?php
}
//end 5
?>

<include file="./template/default/Public/footer-logined.html" />


</body>
</html>